package exercise;

import java.util.Calendar;
import java.util.Date;

/**
 * @classname:CalanderDemo
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/10 16:31
 * @version: 0.1
 * @since:1.8
 */
public class CalenderDemo {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar);
        System.out.println(calendar.get(Calendar.YEAR));
        System.out.println(calendar.get(Calendar.MONTH)+1);
        System.out.println(calendar.get(Calendar.DATE));
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));

        calendar.set(2019,2,12,10,23);
        System.out.println(calendar.get(Calendar.YEAR));
        System.out.println(calendar.get(Calendar.MONTH)+1);
        System.out.println(calendar.get(Calendar.DATE));
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));

        calendar.add(Calendar.DATE,2);
        System.out.println(calendar.get(Calendar.DATE));
        //转换
        calendar.setTime(new Date());
        System.out.println(calendar);
        Date date = calendar.getTime();
        System.out.println(calendar.getActualMaximum(Calendar.DATE));
    }
}
